Skip to content

build(cmake): accept only the same minor version in the package config - #253

Merged
gouyt13 merged 1 commit into
dev/0.9from
build/cmake-same-minor
Nov 19, 2026
Merged

gouyt13 merged 1 commit into
dev/0.9from
build/cmake-same-minor

Conversation

@gouyt13

@gouyt13 gouyt13 commented Nov 19, 2026

Copy link
Copy Markdown
Member

Summary

write_basic_package_version_file used SameMajorVersion. With major version 0 that made find_package(rabitqlib 0.8) accept every 0.x release, including 0.9, which breaks the C++ index API. The package version file now uses SameMinorVersion: a request for X.Y[.Z] is satisfied only by X.Y.z with z >= Z, and a version range must stay within one minor release, such as 0.9...<0.10.

  • CMakeLists.txt: COMPATIBILITY SameMinorVersion, with a comment on why.
  • New CTest PackageVersionCompatibility (tests/core_consumer/check_package_version.cmake): includes the generated rabitqlibConfigVersion.cmake with the variables find_package sets and checks that X.Y and X.Y.0 are accepted and the previous minor and previous major are rejected. Registered for every test build, including core-only builds; no install needed.
  • docs/docs/cpp_integration.md: how to request a version and a range. Release notes: one line under C++ changes.

No file in the repository passes a version to find_package(rabitqlib ...). Consumers that add the library with add_subdirectory do not read the version file.

Found during a pre-release check of dev/0.9.

Testing

Local, Linux x86-64, CMake 3.28:

  • ctest -R PackageVersionCompatibility passes.
  • The script, run against version files generated for 0.8.5, 0.9.0, 0.0.1, 1.0.0 and 1.2.3: passes for SameMinorVersion at all five; fails for SameMajorVersion at 0.8.5, 0.9.0 and 1.2.3 and for AnyNewerVersion at 0.8.5, 0.9.0, 1.0.0 and 1.2.3. At X.0.z the modes cannot be told apart by an older request.
  • Installed package (0.8.5) with real find_package: no version, 0.8, 0.8.0 and 0.8.5 are found; 0.8.6, 0.7, 0.9 and 1.0 are rejected (0.7 was found before this change). Ranges: 0.8...<0.9 is found, 0.8...0.9 is rejected.
  • mkdocs build --strict, git diff --check.

With SameMajorVersion and major version 0, find_package(rabitqlib 0.8)
accepted any 0.x release, including a 0.9 that breaks the API. The package
version file now uses SameMinorVersion. A new CTest,
PackageVersionCompatibility, includes the generated version file and checks
that the same major.minor is accepted and an older minor or major is
rejected. The C++ integration guide explains version requests and ranges.
@github-actions github-actions Bot added the release:build Release category managed from the PR title label Nov 19, 2026
@gouyt13
gouyt13 merged commit dd4d90f into dev/0.9 Nov 19, 2026
35 checks passed
@gouyt13
gouyt13 deleted the build/cmake-same-minor branch November 19, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:build Release category managed from the PR title

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant